<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>


<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${applicationScope.KEY_SITE_NAME}</title>
<link href="resources/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />
<link rel="stylesheet" href="resources/css/extcommon.css"
	type="text/css"></link>
<link rel="stylesheet" href="resources/css/extindex.css" type="text/css"></link>

<script type="text/javascript" src="resources/scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="resources/scripts/extindex.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery-ui.custom.js"></script>
<script type="text/javascript" src="resources/scripts/unslider.min.js"></script>
<script type="text/javascript" src="resources/scripts/common.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery.validate.js"></script>
<script type="text/javascript" src="resources/scripts/rsa/RSA.js"></script>  
<script type="text/javascript" src="resources/scripts/rsa/BigInt.js"></script>  
<script type="text/javascript" src="resources/scripts/rsa/Barrett.js"></script> 


<script type="text/javascript">
<!--
	$(document).ready(
			function() {

				renderButtons();
				$('#kaptchaImage').click(
						function() {//生成验证码  
							$(this).hide().attr(
									'src',
									'kaptcha/getKaptchaImage.do?'
											+ Math.floor(Math.random() * 100))
									.fadeIn();
							event.cancelBubble = true;
						});
				
				
				$('#accept').click(function() {
					
			        if ($(this).is(':checked')) {
			        	$('#submitbtn').button("enable");
			        } else {
			        	$('#submitbtn').button("disable");
			        }
			    });
				

				$("#form1").validate({
					rules : {
						userId : {
							required : true,
							maxlength : 30,
							minlength : 6,
							remote : {
								url : 'user/checkuserid',
								type : 'POST',
								dateType : 'json',
								data : {
									userId : function() {
										return $('#userId').val();
									}
								}
							}
						},
						userM : {							
							maxlength : 40,
							minlength : 6
						},
						password : {
							required : true,
							minlength : 6,
							maxlength : 30
						},
						re_passwrod : {
							required : true,
							minlength : 6,
							maxlength : 30,
							equalTo : "#password"
						},
						qq : {
							maxlength : 60
						},
						email : {
							required : true,
							email : true,
							maxlength : 60
						},
						j_code:{
							required : true,
							remote : {
								url : 'public/user/checkcode',
								type : 'POST',
								dateType : 'json',
								data : {
									checkcode : function() {
										return $('#kaptcha').val();
									}
								}
							}
						}

					},
					
					messages : {
						userId : {
							required : "<spring:message code='msg.input.field.required'/>",
							maxlength : jQuery
									.format("<spring:message code='msg.input.field.maxlength'/>"),
							minlength : jQuery
									.format("<spring:message code='msg.input.field.minlength'/>"),
							remote : "<spring:message code='msg.input.user.exists'/>"
						},
						userM : {
							required : "<spring:message code='msg.input.field.required'/>",
							maxlength : jQuery
									.format("<spring:message code='msg.input.field.maxlength'/>"),
							minlength : jQuery
									.format("<spring:message code='msg.input.field.minlength'/>")
						},
						password : {
							required : "<spring:message code='msg.input.field.required'/>",
							maxlength : jQuery
									.format("<spring:message code='msg.input.field.maxlength'/>"),
							minlength : jQuery
									.format("<spring:message code='msg.input.field.minlength'/>")
						},
						re_passwrod : {
							required : "<spring:message code='msg.input.field.required'/>",
							maxlength : jQuery
									.format("<spring:message code='msg.input.field.maxlength'/>"),
							minlength : jQuery
									.format("<spring:message code='msg.input.field.minlength'/>"),
							equalTo : "<spring:message code='msg.input.password.notEqual'/>"
						},
						qq : {
							maxlength :  jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
						},
						email : {
							required : "<spring:message code='msg.input.field.required'/>",
							email : "<spring:message code='msg.input.email.format'/>",
							maxlength : jQuery.format("<spring:message code='msg.input.field.maxlength'/>")
						},
						j_code:{
							required : "<spring:message code='msg.input.field.required'/>",							
							remote : "<spring:message code='error.login.code.wrong'/>"
						}
					},					
					submitHandler : function (form) {
						encrptPwd(null, "password","re_passwrod", "j_encrypted_pwd");
						form.submit();
					},
					
					errorPlacement: function (error, element) {
						
						if (element.attr("name") === 'j_code') {
							error.insertAfter($("#checkCode"));
						} else {
							error.insertAfter(element);
						}
					}

				});
							
				$(document).ready(function(){
				    $.post("rsa/getkeystr", function(obj,
							status) {
						keym=obj.pkeyMod;
						keye=obj.pkeyExp;
					}); 
				});

});


//-->
</script>
</head>
<body>
	<div class="header">
		<%@include file="../topHeader.jsp"%>

		<div class="header_box clearfix">
			<h1 class="logo">
				<a href="" title="中国网络游戏服务网"></a>
			</h1>
			<!-- 四级联动游戏选择 -->
			<div style="padding-top: 30px; float: left;">
				<h2 style="font-size: 30px; color: #0078AE;">用户注册</h2>
			</div>
			<div style="padding-top: 45px; float: right; margin-right: 20px;">
				<h3 style="font-size: 20px; color: #0078AE; float: left;">&nbsp;&nbsp;1.
					填写基本信息</h3>
				<h3 style="font-size: 20px; color: #ddd; float: left;">&nbsp;&nbsp;2.
					注册完成</h3>
			</div>
		</div>
		<%@include file="../navHeader.jsp"%>
	</div>
	<div class="content">

		<div class="box">
			<h2 style='text-align: center;'>填写用户信息</h2>
			<div class="box" style="border: none;">

				<form id="form1" name="form1" method="post" action="register/user/create"
					style='margin-left: 150px;'>

					<fieldset>
						<div class="formfield">

							<div class="formLabel">
								<label class="needstar">*</label> <label for="userId">用户ID:</label>
							</div>
							<div class="forminput">
								<input type="text" id="userId" name="userId"
									class="text ui-widget-content ui-corner-all" />
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label for="userM">用户显示名称:</label>
							</div>
							<div class="forminput">
								<input type="text" id="userM" name="userM"
									class="text ui-widget-content ui-corner-all" />
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label class="needstar">*</label> <label for="password">密码:</label>
							</div>
							<div class="forminput">
								<input type="password" id="password" name="password"
									class="text ui-widget-content ui-corner-all" />
								<input type="hidden" id="j_encrypted_pwd" name="j_encrypted_pwd"/>
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label class="needstar">*</label> <label for="re_passwrod">重复密码:</label>
							</div>
							<div class="forminput">
								<input type="password" id="re_passwrod" name="re_passwrod"
									class="text ui-widget-content ui-corner-all" />
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label for="qq">QQ:</label>
							</div>
							<div class="forminput">
								<input type="text" id="qq" name="qq"
									class="text ui-widget-content ui-corner-all" />
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label class="needstar">*</label> <label for="email">邮箱:</label>
							</div>
							<div class="forminput">
								<input type="text" id="email" name="email"
									class="text ui-widget-content ui-corner-all" />
							</div>

						</div>

						<div class="formfield">

							<div class="formLabel">
								<label class="needstar">*</label> <label for="kaptcha"><spring:message
										code="Label.index.checkNumber" /></label>
							</div>
							<div class="fltlft checkCodeinput">
								<input type="text" id="kaptcha" name="j_code" maxlength="4"
									class="text ui-widget-content ui-corner-all" />
							</div>
							<div class="checkCode" id="checkCode">
								<img src="kaptcha/getKaptchaImage.do" id="kaptchaImage"/>
							</div>

						</div>

						<div class="formfield">
							<div class="forminput">
								<input type="checkbox" id="accept" name="accept" /> <label
									for="accept">我同意网站<a href="terms.html" target="blank">注册条款</a></label>
							</div>

						</div>



						<div class="forminput">
							<button type="submit" id="submitbtn" disabled="disabled" style="font-size:18px">同意上面协议并提交注册</button>
						</div>

					</fieldset>
				</form>

			</div>
		</div>

	</div>
	<%@include file="../footer.jsp"%>
</body>
</html>